package com.ssy.jt808.gateway.client.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;

/**
 * @author zeno
 */
@Data
@NoArgsConstructor
public abstract class JtRequestBase extends JtMessageBase{

  protected String host;

  protected JtRequestBase( int messageId ){
    super(messageId);
  }

  protected JtRequestBase( String clientId, int messageId ){
    super(clientId, messageId);
  }

  public void setHost( String host ){
    this.host = "http://" + host;
  }

  public HttpMethod method(){
    return HttpMethod.POST;
  }

  ;

  public abstract String url();

  public ParameterizedTypeReference replyTypeRef(){
    return new ParameterizedTypeReference<JtResponse<T8001Reply>>(){ };
  }
}
